<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<h:form id="suchform_answers">
	<rich:collapsiblePanel expanded="true">
	<f:facet name="header">suchen . . .</f:facet>
	<table class="searchTable_answers">
		<tr>
			<td>Teilnehmer</td>
			<td><rich:autocomplete value="#{AnswerViewBean.participant}" autocompleteMethod="#{AnswerViewBean.selectParticipantNamesforAutoCompletion}" autofill="true" mode="cachedAjax" minChars="1"/></td>
			<td>Umfrage-Bezeichnung</td>
			<td><rich:autocomplete value="#{AnswerViewBean.survey_label}" autocompleteMethod="#{AnswerViewBean.selectSurveyLabelforAutoCompletion}" autofill="true" mode="cachedAjax" minChars="1"/></td>
		</tr>
		<tr>
			<td>Fragebogen-Bezeichnung</td>
			<td><rich:autocomplete value="#{AnswerViewBean.questionSheet_label}" autocompleteMethod="#{AnswerViewBean.selectQuestionSheetforAutoCompletion}" autofill="true" mode="cachedAjax" minChars="1"/></td>
			<td></td>
			<td></td>
		</tr>
		<tr>
			<td colspan="4"><hr/></td>
		</tr>
		<tr>
			<td colspan="4"><center><a4j:commandButton id="searchButton" action="#{AnswerViewBean.refreshFilteredView()}" value="suchen" execute="suchform_answers" render="answerTableForm datascrolleroben_answers datascrollerunten_answers" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();"/></center></td>
		</tr>
	</table>
	</rich:collapsiblePanel>
	</h:form>
	<center><rich:dataScroller id="datascrolleroben_answers" for="table_answers" maxPages="10" stepControls="auto" render="datascrollerunten_answers"/></center>
	<h:form id="answerTableForm">
	
	<a4j:jsFunction  name="rowupdate" action="#{AnswerViewBean.innerCompShow()}" actionListener="#{AnswerViewBean.selectionListener}" execute="answerTableForm" render="answerDetail">
    </a4j:jsFunction>
	<rich:extendedDataTable value="#{AnswerViewBean.answersSheets}" binding="#{AnswerViewBean.dataTable}"
            var="answers" id="table_answers" frozenColumns="4" rows="10"
             selectionMode="single" styleClass="questionOverviewTable"
            noDataLabel="keine Antworten verfügbar" keepSaved="false"
            rowClasses="rowstyle1,rowstyle2" selection="#{AnswerViewBean.selection}" onrowdblclick="rowupdate()">

            <f:facet name="header">
                <h:outputText value="Antworten" />
            </f:facet>
            <rich:column width="200px">
                <f:facet name="header">
                    <h:outputText value="Umfrage" />
                </f:facet>
			<h:outputText value="#{answers.umfrage.bezeichnung}" />
		</rich:column>
            <rich:column width="200px">
                <f:facet name="header">
                    <h:outputText value="Ersteller" />
                </f:facet>
                <h:outputText value="#{answers.teilnehmer.name}" rendered="#{answers.teilnehmer != null}"/>
            	<h:outputText value="Anonyme" rendered="#{answers.teilnehmer == null}"/>
            </rich:column>
            <rich:column width="200px">
                <f:facet name="header">
                    <h:outputText value="Fragebogen" />
                </f:facet>
                <h:outputText value="#{answers.umfrage.fragebogen.bezeichnung}" />
            </rich:column>
        </rich:extendedDataTable>
        </h:form>
		<center><rich:dataScroller id="datascrollerunten_answers" for="table_answers" maxPages="10" stepControls="auto" render="datascrolleroben_answer"/></center>														
		
		
		<ui:include src="ViewAnswerInnerComp.xhtml"/>
		
</ui:composition>
